package com.czp.mall.feign.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.czp.mall.config.ItemFeignClientConfiguration;
import com.czp.mall.feign.fallbackFactory.ItemServiceFeignHystrixClientFallbackFactory;
import com.czp.mall.feign.pojo.Item;
import com.czp.mall.feign.service.impl.ItemServiceFeignHystrixClientFallback;

import feign.Param;
import feign.RequestLine;


/**
 * feign中使用hystrix
 * 
 * @author chaiz
 *
 */

@FeignClient(name = "czp-mall-item" , 
			configuration = ItemFeignClientConfiguration.class,  // 自定义配置方式
//			fallback = ItemServiceFeignHystrixClientFallback.class, // feign中使用hystrix回调类
			fallbackFactory = ItemServiceFeignHystrixClientFallbackFactory.class) // 获取触发hystrix的原因
public interface ItemServiceFeignHystrixClient {

	// 使用feign默认的注解实现
	@RequestLine("GET /item/{id}")
	 public Item queryItemById(@Param("id") Long id);
	
}
